Skip to main content
Version: 2.5.7 - 2.5.1

Common

api.ledControl(state)

Turns ON or OFF the on board LED. It can be also used for debugging purposes.

api.delayms(ms)

Pause the execution for ms milliseconds.

api.randInt(min, max)

Generate random number within given range.

Available only for LoRaWAN devices (function uses it's module to generate random number)

api.getUniqueNumber()

Returns an unique integer number in range (in range from 0 to 2^32)*.

api.getBatteryVoltage()

Get curent battery voltage in mV.

api.getTick()

Returns current number of milliseconds since startup. Counts up to 2^32 and then restarts from 0. By default it's using RTC derived tick which is incremented during sleep, but it's possible to explicitly select systick, which isn't.

api.dumpArray(str)

Prints contents of variable as hexadecimal string (dumps array into console)

api.float(op,form,arg1,arg2)

Performs operation with given floating point data.

Only if it's allowed by the firmware. Convert function available from FW version v2.5.1

api.setVar(index, value)

Saves a persistent variable value, can be used between different wake up iterations.

api.getVar(index)

Returns persistent variable value, can be used between different wake up iterations.

api.wakeUpAt(day, hour, minute, second)

Schedules the next wake up event of the device to provided day of month (day), hour, minute and second. The provided wake up date is therefore absolute and not relative as in wakeUpIn().

api.wakeUpIn(day, hour, minute, second)

Schedules the next wake up event of the device after specified time interval. The provided wake up date is therefore relative and not absolute as in wakeUpAt(). Note: The input arguments are not limited, but the total period specified must not exceed 31 days. (e.g. hour = 40, days = 2 gives a period of 3 days and 16 hours).

api.getTimeDate()

Returns current date and time set on this device. The time can be synchronized over LoRa, or when uploading LUA script using LUA scripting interface.

api.setTimeDate(year, month, day, hour, minute, second)

Set date and time on this device.